package cn.kgc.javaweb.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author: mosin
 * @version: v1.0  2022/5/23
 * http
 */
@WebServlet("/hello")
public class HelloServlet extends HttpServlet {

    //@Override
    //protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    //    System.out.println("get请求被接收");
    //    //业务逻辑
    //    System.out.println("业务逻辑被调用");
    //}
    //
    //@Override
    //protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    //    System.out.println("post请求被接收");
    //    doGet(req, resp);
    //}

    // 既可以处理get请求  也可以处理post请求
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("hello servlet");
    }


}
